import 'package:equatable/equatable.dart';
import 'package:backend.purchases/domain/entities/yookassa_api/payments/yookassa_api_payment.dart';
import 'package:backend.purchases/domain/entities/yookassa_api/yookassa_api_money_amount.dart';

class YookassaApiPendingPayment extends Equatable implements YookassaApiPayment {
  const YookassaApiPendingPayment({
    required this.id,
    required this.amount,
    required this.purchaseItemSku,
    required this.userId,
    required this.savedPaymentMethodId,
    required this.test,
    required this.confirmationInfo,
    required this.paymentMethod,
    required this.creationTime,
  });

  @override
  final String id;

  @override
  final YookassaApiMoneyAmount amount;

  @override
  final String purchaseItemSku;

  @override
  final String userId;

  @override
  final String? savedPaymentMethodId;

  @override
  final bool test;

  final YookassaApiPendingPaymentConfirmationInfo confirmationInfo;
  final YookassaApiPendingPaymentMethod paymentMethod;
  final DateTime creationTime;

  @override
  List<Object?> get props {
    return [
      id,
      amount,
      purchaseItemSku,
      userId,
      savedPaymentMethodId,
      test,
      confirmationInfo,
      paymentMethod,
      creationTime,
    ];
  }
}

class YookassaApiPendingPaymentMethod extends Equatable {
  const YookassaApiPendingPaymentMethod({
    required this.id,
    required this.saved,
  });

  final String id;
  final bool saved;

  @override
  List<Object?> get props {
    return [
      id,
      saved,
    ];
  }
}

abstract class YookassaApiPendingPaymentConfirmationInfo {}

class YookassaApiPendingPaymentRedirectConfirmationInfo extends Equatable
    implements YookassaApiPendingPaymentConfirmationInfo {
  const YookassaApiPendingPaymentRedirectConfirmationInfo({
    required this.returnUrl,
    required this.confirmationUrl,
  });

  final String returnUrl;
  final String confirmationUrl;

  @override
  List<Object?> get props {
    return [
      returnUrl,
      confirmationUrl,
    ];
  }
}
